package com.tcl.network;

import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;

/**
 * <br> 网络请求工具类
 * Created by xinhong.zhang on 2016/7/20.
 */
public class NetworkUtil {
    public static int getVersionCode(Context context) {
        PackageInfo pi= null;
        int versionCode = 0;
        try {
            pi = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
            versionCode = pi.versionCode;
        } catch (PackageManager.NameNotFoundException e) {
            e.printStackTrace();
        }
        return versionCode;
    }
}